/**
 * 
 */
package officeserver.office;

import java.io.IOException;
import java.util.ArrayList;

import officeserver.log_error.AppointmentException;
import officeserver.log_error.OfficeException;
import officeserver.log_error.UserException;
import officeserver.office.request.RequestException;
import officeserver.report.Appointment;
import officeserver.users.AccessLevel;
import officeserver.users.PersonalInfo;

/**
 * @author Chris Bayruns
 * 
 */
public interface OfficeInterface {
    /**
     * This logs in a user.
     * 
     * @author Chris Bayruns
     * @param username
     *            The username to log int to.
     * @param password
     *            The password
     * @throws IOException
     * @throws ClassNotFoundException
     * @throws UserException
     * @throws RequestException
     */
    public boolean userLogin(String username, String password)
	    throws UserException, RequestException;

    /**
     * Logs the user out.
     * 
     * @author Chris Bayruns
     * @throws Exception
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public void userLogout() throws Exception;

    /**
     * @author Chris Bayruns
     * @return Whether you are logged in
     * @throws Exception
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public boolean isLoggedIn() throws Exception;

    /**
     * Adds a user
     * 
     * @author Chris Bayruns
     * @param firstName
     *            The first name
     * @param lastName
     *            The last name
     * @param username
     *            The username
     * @param password
     *            The password
     * @param accessLevel
     *            The access level
     * @throws UserException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public void addUser(String firstName, String lastName, String username,
	    String password, AccessLevel accessLevel) throws UserException;

    /**
     * @author Chris Bayruns
     * @param id
     *            The id to search for
     * @param level
     *            The level to search in
     * @throws ClassNotFoundException
     * @throws IOException
     * @throws UserException
     */
    public void userSearch(int id, AccessLevel level) throws UserException;

    /**
     * @author Chris Bayruns
     * @param username
     *            The username to search for
     * @throws ClassNotFoundException
     * @throws IOException
     * @throws UserException
     */
    public void userSearch(String username) throws UserException;

    /**
     * @author Chris Bayruns
     * @param firstName
     *            The first name to search for
     * @param lastName
     *            The last name to search for
     * @throws ClassNotFoundException
     * @throws IOException
     * @throws UserException
     */
    public void userSearch(String firstName, String lastName)
	    throws UserException;

    /**
     * @author Chris Bayruns
     * @param info
     *            The info to set
     * @throws IOException
     * @throws ClassNotFoundException
     * @throws UserException
     */
    public void setSelfPersonalInfo(PersonalInfo info) throws UserException;

    /**
     * @author Chris Bayruns
     * @return The personal info object associated with your account
     * @throws UserException
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public PersonalInfo getSelfPersonalInfo() throws UserException;

    /**
     * @author Chris Bayruns
     * @return The personal info of the user searched for
     * @throws UserException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public PersonalInfo getSearchPersonalInfo() throws UserException;

    /**
     * @author Chris Bayruns
     * @param info
     *            Sets the personal info of the searched user
     * @throws UserException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public void setSearchPersonalInfo(PersonalInfo info) throws UserException;

    /**
     * Deletes a user
     * 
     * @author Chris Bayruns
     * @throws UserException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public void deleteSearchUser() throws UserException;

    /**
     * @author Chris Bayruns
     * @return An arraylist of the patients appointments
     * @throws UserException
     * @throws AppointmentException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public ArrayList<Appointment> getSelfAppointments() throws UserException,
	    AppointmentException;

    /**
     * @author Chris Bayruns
     * @param day
     *            The day to search
     * @return The avaliablity of dat
     * @throws Exception
     */
    public boolean[][] selfCheckCalendar(int day) throws Exception;

    /**
     * @author Chris Bayruns
     * @param docID
     *            The doctor you want
     * @param day
     *            The day you want
     * @param timeSlot
     *            The timeslot you want
     * @throws Exception
     */
    public void addSelfAppointment(int docID, int day, int timeSlot)
	    throws Exception;

    /**
     * @author Chris Bayruns
     * @return The arraylist of the appointments
     * @throws UserException
     * @throws ClassNotFoundException
     * @throws IOException
     * @throws AppointmentException
     * @throws Exception
     */
    public ArrayList<Appointment> getWaitingAppointments()
	    throws UserException,AppointmentException;

    /**
     * @author Chris Bayruns
     * @throws UserException
     * @throws AppointmentException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public void confirmSearchUserAppointment(Appointment confirm)
	    throws UserException, AppointmentException;

    /**
     * @author Chris Bayruns
     * @param update
     *            The appointment to update
     * @throws Exception
     */
    public void updateSearchUserAppointment(Appointment update)
	    throws Exception;

    /**
     * @author Chris Bayruns
     * @param day
     *            The day to get appointments on
     * @return The arraylist of the appointments
     * @throws Exception
     */
    public ArrayList<Appointment> getAppointmentsByDay(int day)
	    throws Exception;

    /**
     * @author Chris Bayruns
     * @param delete
     *            The appointment to delete
     * @throws Exception
     */
    public void deleteSearchUserAppointment(Appointment delete)
	    throws Exception;

    /**
     * @author Chris Bayruns
     * @return An arraylist of the patients appointments
     * @throws UserException
     * @throws AppointmentException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public ArrayList<Appointment> getSearchUserAppointments()
	    throws UserException, AppointmentException;
    /**
     * @author Chris Bayruns
     * @param index The index of the appointment you want
     * @return An arraylist of the patients appointments
     * @throws UserException
     * @throws AppointmentException
     * @throws ClassNotFoundException
     * @throws IOException
     */
    public Appointment getSearchUserAppointments(int index)
    throws UserException, AppointmentException;
    
    public Integer getSearchUserNumAppointments()
    throws UserException, AppointmentException;
    public Integer getSelfUserNumAppointments()
    throws UserException, AppointmentException;
    
    public void load() throws OfficeException;

    public void save() throws OfficeException;
    
    public ArrayList<PersonalInfo> getAllUsers() throws UserException,  AppointmentException;
    
    public boolean isBooked(int day) throws  UserException, AppointmentException;

	public ArrayList<PersonalInfo> getDoctors() throws UserException;

	public ArrayList<PersonalInfo> getNurses() throws UserException;

	public ArrayList<PersonalInfo> getActivePatients() throws UserException;

}
